@echo off

rem Start up PDMS Dev, allowing for PDMSEXE being a search path, and
rem some arguments to pass into monitor

setlocal

rem set pdms_path=%1

SET pdms_installed_dir=C:\AVEVA\Pdms11.5\

rem Set evars for PDMS
call %pdms_installed_dir%\evars %pdms_installed_dir%

set savepath=%path%
if not "%PDMS_ACAD%"=="" goto acaddone
set acad_version=%PDMS_ACAD%
rem echo %path%
:acaddone

:run
rem Reverse order of PDMSEXE so we find the earliest one first
set reversed=
for %%x in ( %PDMSEXE% ) do call pdms_reverse %%x

rem Find mon.exe
set found=
for %%x in ( %reversed% ) do call pdms_findexe %%x mon.exe
if "%found%"=="" goto nomon
set monexe=%found%

rem If we have no arguments, add 'graphics' so that monitor doesn't
rem think we are coming from a module-switch
set args=%1 %2 %3 %4 %5 %6
if "%1"=="" set args=graphics

rem For Autocad 2000i and 2002
set PDMS_ACAD=2000i
set ACAD_VERSION=%PDMS_ACAD%
set PDMS_ACAD_PATH=C:\program files\AutoCAD 2000i;C:\Program Files\Common Files\Autodesk Shared

rem The following directories should contain the executables - %PDMS_ACAD_PATH%
rem Alternatively, edit this macro for your own setup.

set path=%PDMSEXE%\autodraftACAD;%PDMS_ACAD_PATH%;%path%

rem Evar to workaround unwanted interaction of PDMS launcher and PLOT input;
set PDMS_CONSOLE_WINDOW=ACTIVE

rem We have found mon.exe somewhere, so start it up
rem with any arguments the user passed us
echo running: %monexe%\mon %args%
start %monexe%\mon %args%
goto end

:nomon
echo Sorry, cannot find mon.exe within your PDMSEXE - %PDMSEXE%
goto end

:end
set path=%savepath%
endlocal
